﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TDDSample.Models;

namespace TDDSample.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        private IDateProvider _provider;
        private StringDictionary _holidayViews;
        public HomeController(IDateProvider provider)
        {
            _provider = provider;
            _holidayViews = new StringDictionary();
            _holidayViews.Add("25-12", "StoreClosed");
            _holidayViews.Add("01-01", "HappyNewYear");
        }

        public ActionResult Index()
        {
            return View(GetViewByDate(_provider.GetDate()));
        }

        private string GetViewByDate(DateTime date)
        {
            return _holidayViews[date.ToString("dd-MM",
                CultureInfo.InvariantCulture)] ?? "Index";
        }
    }
}
